package com.sunny.shop.api.v1;

import com.sunny.shop.model.Category;
import com.sunny.shop.service.CategoryServiceImpl;
import com.sunny.shop.vo.CategoryAllVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/category")
@Validated
public class CategoryController {
    @Autowired
    private CategoryServiceImpl categoryService;

//    @GetMapping("/all")
//    public CategoryAllVo getAll(){
//        Map<Integer, List<Category>> all = categoryService.getAll();
//        return new CategoryAllVo(all);
//    }

    @GetMapping("/riddle")
    public List<Category> getRiddleCate(){
        List<Category> cateByType = categoryService.getCateByType();
        return cateByType;
    }

    @GetMapping("/story")
    public List<Category> getStoryCate(){
        List<Category> cateByType = categoryService.getStoryCate();
        return cateByType;
    }
}
